﻿using System;
using UnityEngine;
using BridgeUI.Model;

namespace BridgeUI
{
    public struct UICreateHandle
    {
        public delegate void CreateCallBack(GameObject go, UIInfoBase uiNode, Bridge bridge, Transform parent, IUIPanel parentPanel);
        public CreateCallBack onCreate { get; set; }
        public UIInfoBase uiNode { get; set; }
        public Bridge bridge { get; set; }
        public Transform parent { get; set; }
        public IUIPanel parentPanel { get; set; }

        public void OnCreate(GameObject go)
        {
            if (onCreate != null)
            {
                if (go != null)
                {
                    onCreate(go, uiNode, bridge, parent, parentPanel);
                }
                else
                {
                    throw new Exception("资源为空！");
                }
            }
        }
    }
}
